package org.jianghu.base;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Window;

import org.jianghu.utils.ExitAppUtils;


/**
 * Created by Gtexpress on 16/12/1.
 */


public abstract class BaseActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);

        initParmers();
        initViewsAndValues(savedInstanceState);

        ExitAppUtils.getInstance().addActivity(this);

    }


    /**
     * 初始化页面控件
     */
    public abstract void initViewsAndValues(Bundle savedInstanceState);

    /**
     * 初始化变量
     */
    public abstract void initParmers();

    /**
     * 在onDestory()手动释放资源
     */
    public abstract void releaseOnDestory();


    @Override
    protected void onDestroy() {
        super.onDestroy();
        releaseOnDestory();
        System.gc();
    }

}
